class Animal {
  say() {
    console.log("Animal");
  }
}

class Dog extends Animal {
  say() {
    console.log("Dog");
  }
}
class Person extends Animal {
  say() {
    console.log("Person");
  }
}

function switchSay(fn: Animal[]) {
  fn.forEach((item) => {
    item.say();
  });
}

switchSay([new Person(), new Dog()]); // Person   Dog

export {};
